package com.xiaocg.base.thread.pool;

import java.util.concurrent.atomic.AtomicInteger;

public class WorkThread extends Thread{

    private Runnable r;
    private AtomicInteger atomicInteger;

    public WorkThread(Runnable r, AtomicInteger atomicInteger) {
        this.r = r;
        this.atomicInteger = atomicInteger;
    }

    public WorkThread() {
    }

    @Override
    public void run() {
        try {
            r.run();
        }finally {
            atomicInteger.getAndDecrement();
        }
    }
}
